package com.speech.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.speech.R;
import com.speech.adapter.MissionNoobListViewAdapter;
import com.speech.item.MissionNoobListViewItem;
import com.speech.utils.MissionNoobFinishState;
import com.speech.utils.TitleBuilder;

import java.util.ArrayList;
import java.util.List;

public class MissionNoobActivity extends BaseActivity {

    private ListView lv;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mission_noob);
        _initView();

        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position){
                    case 0:
                        startActivity(new Intent(MissionNoobActivity.this,FollowWeixinGZHActivity.class));
                        break;
                    case 1:
                        startActivity(new Intent(MissionNoobActivity.this,FollowWeixinSQActivity.class));
                        break;
                    case 2:
                        //修改昵称
                        startActivity(new Intent(MissionNoobActivity.this,EditNickNameActivity.class));
                        break;
                    case 3:
                        startActivity(new Intent(MissionNoobActivity.this,EditMineEntranceActivity.class));
                        break;
                }
            }
        });

    }

    private void _initView() {
        new TitleBuilder(this).setTitleText("新手任务");

        lv = findViewById(R.id.lv_missionNoob);

        List<MissionNoobListViewItem> lstData = new ArrayList<>();

        int drawable_go_finish_res = R.drawable.btn_go_to_finish;
        int drawable_finish = R.drawable.btn_done;

        if(MissionNoobFinishState.getGongzhonghaoState()){

        }
        MissionNoobListViewItem item_follow_weixin = new MissionNoobListViewItem(
                R.drawable.weixin_2x,
                R.drawable.btn_go_to_finish,
                "关注公众号",
                "关注SPK官方公众号，见证项目发展",
                1000
        );
        MissionNoobListViewItem item_join_weixin = new MissionNoobListViewItem(
                R.drawable.house_2x,
                R.drawable.btn_go_to_finish,
                "加入微信社区",
                "欢迎加入SPK语言数据社区大家庭",
                1000
        );
        MissionNoobListViewItem item_change_name = new MissionNoobListViewItem(
                R.drawable.friend_follow_2x,
                R.drawable.btn_go_to_finish,
                "修改昵称",
                "每个SPK成员的社区称呼",
                500
        );
        MissionNoobListViewItem item_upload_head = new MissionNoobListViewItem(
                R.drawable.camara_2x,
                R.drawable.btn_go_to_finish,
                "上传头像",
                "每个SPK成员的图像身份",
                500
        );

        lstData.add(item_follow_weixin);
        lstData.add(item_join_weixin);
        lstData.add(item_change_name);
        lstData.add(item_upload_head);

        MissionNoobListViewAdapter listViewAdapter = new MissionNoobListViewAdapter(lstData,MissionNoobActivity.this);
        lv.setAdapter(listViewAdapter);

    }
}
